$\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\
$\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\
$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
+$\mathit{RO}_\mathit{run}$ & {\tt domid} & int & domain ID (if available, -1 otherwise) \\
$\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\
$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VM\_metrics ref & metrics associated with this VM. \\
\hline
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_domid}
+
+{\bf Overview:}
+Get the domid field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} int get_domid (session_id s, VM ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VM ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+int
+}
+
+
+value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
char *pci_bus;
xen_string_string_map *tools_version;
xen_string_string_map *other_config;
+ int64_t domid;
bool is_control_domain;
struct xen_vm_metrics_record_opt *metrics;
} xen_vm_record;
xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm);
+/**
+ * Get the domid field of the given VM.
+ */
+extern bool
+xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm);
+
+
/**
* Get the is_control_domain field of the given VM.
*/
{ .key = "other_config",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_vm_record, other_config) },
+ { .key = "domid",
+ .type = &abstract_type_int,
+ .offset = offsetof(xen_vm_record, domid) },
{ .key = "is_control_domain",
.type = &abstract_type_bool,
.offset = offsetof(xen_vm_record, is_control_domain) },
}
+bool
+xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ abstract_type result_type = abstract_type_int;
+
+ XEN_CALL_("VM.get_domid");
+ return session->ok;
+}
+
+
bool
xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm)
{
'VTPMs',
'PCI_bus',
'tools_version',
+ 'domid',
'is_control_domain',
]
def VM_get_other_config(self, session, vm_ref):
return self.VM_get('other_config', session, vm_ref)
+ def VM_get_domid(self, _, ref):
+ domid = XendDomain.instance().get_vm_by_uuid(ref).getDomid()
+ return xen_api_success(domid is None and -1 or domid)
+
def VM_get_is_control_domain(self, session, vm_ref):
xd = XendDomain.instance()
return xen_api_success(
xeninfo = xendom.get_vm_by_uuid(vm_ref)
if not xeninfo:
return xen_api_error(['HANDLE_INVALID', 'VM', vm_ref])
-
+
+ domid = xeninfo.getDomid()
+
record = {
'uuid': xeninfo.get_uuid(),
'power_state': xeninfo.get_power_state(),
'PCI_bus': xeninfo.get_pci_bus(),
'tools_version': xeninfo.get_tools_version(),
'other_config': xeninfo.info.get('other_config', {}),
+ 'domid': domid is None and -1 or domid,
'is_control_domain': xeninfo == xendom.privilegedDomain(),
}
return xen_api_success(record)